package com.highspeed.bdk.gateway.socket.analyze.message.gui.resolver;

import com.highspeed.bdk.gateway.Util;
import com.highspeed.bdk.gateway.socket.analyze.message.gui.base.MessageResolver;

import java.util.Map;

/**
 * 3.22反馈链路统计信息
 */
public class LinkFlowResolver0x24 extends MessageResolver {

    @Override
    protected Map doResolveBody(byte[] response) {
        int linkSum = Util.getInt(response, getOffset());
        offset4();
        logger.info("ink的总条数......." + linkSum);

        short oneLinkDataLen = Util.getShort(response, getOffset());
        offset2();
        logger.info("每条链路的数据的长度......." + oneLinkDataLen);

        short reserved = Util.getShort(response, getOffset());
        offset2();
        logger.info("reserved......." + reserved);

        OneLogicLinkFlowResolver oneLogicLinkFlowResolver = new OneLogicLinkFlowResolver();
        oneLogicLinkFlowResolver.setContainer(getContainer());
        for (int i = 0; i < linkSum; i++) {
            oneLogicLinkFlowResolver.doResolveBody(response);
        }
        return getContainer();
    }
}
